package gae.testjig.client.eventbus;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;

public class ChannelMetaEvent extends GwtEvent<ChannelMetaEvent.Handler> {

	public interface Handler extends EventHandler {
		public void onFeedback(String message);
	}
	
	static private Type<Handler> TYPE = new Type<Handler>();
	static public HandlerRegistration register(EventBus bus, Handler handler) {
		return bus.addHandler(TYPE, handler);
	}
	
	private String message;

	public ChannelMetaEvent(String message) {
		this.message = message;
	}
	
	@Override
	protected void dispatch(Handler handler) {
		handler.onFeedback(message);
	}
	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

}
